import { type pageInfo } from '@/page/types/base/baseRequestPage'

export interface couponInfo {
  /**
   * 优惠券名称
   */
  name: string

  /**
   * 优惠券最小使用金额
   */
  minAmount: number

  /**
   * 金额/折扣
   */
  amount: number

  /**
   * 优惠券开始时间
   */
  startTime: string

  /**
   * 优惠券结束时间
   */
  endTime: string

  /**
   * 优惠券有效天数
   */
  days: number

  /**
   * 优惠券是否有效
   */
  work: boolean

  /**
   * 优惠券描述
   */
  describes: string

  /**
   * 优惠券总数
   */
  totalCount: number

  /**
   * 优惠券限领次数
   */
  limitNum: number
}
export interface couponTable extends couponInfo {
  /**
   * 优惠券类型
   */
  type: {}

  /**
   * 优惠券折扣类型
   */
  discountType: {}
  /**
   * 优惠券时间类型
   */
  timeType: {}
}
export interface couponEdit extends couponInfo {
  /**
   * 优惠券类型
   */
  type: string

  /**
   * 优惠券折扣类型
   */
  discountType: string
  /**
   * 优惠券时间类型
   */
  timeType: string
}
export interface couponSearch extends pageInfo {
  /**
   * 优惠券名称
   */
  name: string
  /**
   * 优惠券类型
   */
  type: {}

  /**
   * 优惠券折扣类型
   */
  discountType: {}
  /**
   * 优惠券时间类型
   */
  timeType: {}
}
export class couponClass {
  couponS: couponSearch = {
    name: '',
    type: '',
    discountType: '',
    timeType: '',
    page: 1,
    size: 10,
    total: 0
  }
  couponEdit: couponEdit = {
    type: '',
    discountType: '',
    timeType: '',
    name: '',
    minAmount: 0,
    amount: 0,
    startTime: '',
    endTime: '',
    days: 0,
    work: false,
    describes: '',
    totalCount: 0,
    limitNum: 0
  }
  couponTable = []
  goodsTable = {}
  checkedGoods = []
  couponDialog = false
  goodsDialog = false
  isHaveDate = false
  isHaveTime = false
  addGoodsCouponId = ''
  couponRule = {
    name: [
      {
        required: true,
        message: '优惠券名称不能为空',
        trigger: 'blur'
      }
    ],
    type: [
      {
        required: true,
        message: '优惠券类型不能为空',
        trigger: 'change'
      }
    ],
    discountType: [
      {
        required: true,
        message: '优惠券折扣类型不能为空',
        trigger: 'change'
      }
    ],
    timeType: [
      {
        required: true,
        message: '优惠券时间类型不能为空',
        trigger: 'change'
      }
    ],
    minAmount: [
      {
        required: true,
        message: '最小使用金额不能为空',
        trigger: 'change'
      }
    ],
    amount: [
      {
        required: true,
        message: '金额/折扣不能为空',
        trigger: 'change'
      }
    ],
    totalCount: [
      {
        required: true,
        message: '总数不能为空',
        trigger: 'change'
      }
    ],
    limitNum: [
      {
        required: true,
        message: '限领数不能为空',
        trigger: 'change'
      }
    ]
  }
  discountTypeList = [
    {
      value: 'FULL',
      label: '满减券'
    },
    {
      value: 'DISCOUNT',
      label: '折扣券'
    }
  ]
  couponTimeList = [
    {
      value: 'FIXED_DAY',
      label: '固定天数'
    },
    {
      value: 'FIXED_TIME',
      label: '固定时间'
    }
  ]
  couponTypeList = [
    {
      value: 'UNIVERSAL',
      label: '通用券'
    },
    {
      value: 'GOODS',
      label: '商品券'
    }
  ]
  title = [
    { label: '名称', name: 'name' },
    { label: '创建时间', name: 'createTime' }
  ]
  goodsLeftS = {
    page: 1,
    size: 2,
    total: 0
  }
  goodsRightS = {
    page: 1,
    size: 2,
    total: 0
  }
}
